package com.csdj.t309.controller;

import com.csdj.t309.entity.Cityarea;
import com.csdj.t309.entity.CityareaExample;
import com.csdj.t309.entity.Driverschool;
import com.csdj.t309.entity.DriverschoolExample;
import com.csdj.t309.mapper.CityareaMapper;
import com.csdj.t309.service.CityareaService;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
public class CityareaController {
    @Autowired
    private CityareaService cityareaService;
    @ResponseBody
    @GetMapping("xiala")
    public List<Cityarea> xiala()   {
        List<Cityarea> list=cityareaService.selectByExample(new CityareaExample());
        return list;
    }
    @ResponseBody
    @GetMapping("diqucha")
    public Cityarea diqucha(String id)   {
        CityareaExample cityareaExample=new CityareaExample();
        cityareaExample.createCriteria().andIdEqualTo(Integer.parseInt(id));
        List<Cityarea> list=cityareaService.selectByExample(cityareaExample);
        return list.get(0);
    }
}
